﻿namespace z8.Common
{
    using System;
    using System.Data;
    using zyn_hy_login;

    public class Users
    {
        private int id;
        private int id2;
        private int id3;
        private string name;
        private string yh_Connstr;
        private string yh_group;
        private string yh_login_name;
        private string yh_Tbname;
        private string yh_treeid;
        private string zt;

        public Users()
        {
        }

        public Users(int strId)
        {
            string text = "select * from z8 where sign='user' and  ";
            object obj2 = text;
            DataRow row = DBCommon.getDataBySql(string.Concat(new object[] { obj2, " id = ", strId, " " })).Tables[0].Rows[0];
            this.id = (int) row["id"];
            this.id2 = (int) row["id2"];










































            this.id3 = (int) row["id3"];
            this.name = row["name"].ToString().Trim();
            this.zt = row["zt"].ToString().Trim();
            this.yh_login_name = row["x57"].ToString().Trim();
            this.yh_treeid = row["id3"].ToString().Trim();
            this.yh_group = row["x59"].ToString().Trim();
            DB_conn _conn = new DB_conn(row["id3"].ToString().Trim());
            this.yh_Connstr = _conn.ConnString;
            this.yh_Tbname = _conn.DbTable;
        }

        public Users(string str_userName)
        {
            string text = "select * from z8 where sign='user' and  ";
            DataRow row = DBCommon.getDataBySql(text + " x57 = '" + str_userName + "' ").Tables[0].Rows[0];
            this.id = (int) row["id"];
            this.id2 = (int) row["id2"];
            this.id3 = (int) row["id3"];
            this.name = row["name"].ToString().Trim();
            this.zt = row["zt"].ToString().Trim();
            this.yh_login_name = row["x57"].ToString().Trim();
            this.yh_treeid = row["id3"].ToString().Trim();
            this.yh_group = row["x59"].ToString().Trim();
            DB_conn _conn = new DB_conn(row["id3"].ToString().Trim());
            this.yh_Connstr = _conn.ConnString;
            this.yh_Tbname = _conn.DbTable;
        }

        public int UserCheck(string str_name, string str_pwd)
        {
            SecurityZ8 yz = new SecurityZ8();
            string text = "select id from z8 where sign='user' and ";
            return DBCommon.excuteSqlCount((text + " x57 = '" + str_name + "' and") + " x58 = '" + yz.Encrypt(str_pwd) + "'");
        }

        public int Id
        {
            get
            {
                return this.id;
            }
            set
            {
                this.id = value;
            }
        }

        public int Id2
        {
            get
            {
                return this.id2;
            }
            set
            {
                this.id2 = value;
            }
        }

        public int Id3
        {
            get
            {
                return this.id3;
            }
            set
            {
                this.id3 = value;
            }
        }

        public string Name
        {
            get
            {
                return this.name;
            }
            set
            {
                this.name = value;
            }
        }

        public string Yh_Connstr
        {
            get
            {
                return this.yh_Connstr;
            }
            set
            {
                this.yh_Connstr = value;
            }
        }

        public string Yh_group
        {
            get
            {
                return this.yh_group;
            }
            set
            {
                this.yh_group = value;
            }
        }

        public string Yh_login_name
        {
            get
            {
                return this.yh_login_name;
            }
            set
            {
                this.yh_login_name = value;
            }
        }

        public string Yh_Tbname
        {
            get
            {
                return this.yh_Tbname;
            }
            set
            {
                this.yh_Tbname = value;
            }
        }

        public string Yh_treeid
        {
            get
            {
                return this.yh_treeid;
            }
            set
            {
                this.yh_treeid = value;
            }
        }

        public string Zt
        {
            get
            {
                return this.zt;
            }
            set
            {
                this.zt = value;
            }
        }
    }
}

